<?php

namespace App\Models;

use DateTimeInterface;
use Illuminate\Database\Eloquent\Model;
use Spatie\EloquentSortable\Sortable;
use Spatie\EloquentSortable\SortableTrait;

class Doctor extends Model implements Sortable
{

    use SortableTrait;

    public $sortable = [
        'order_column_name' => 'order_n',
        'sort_when_creating' => true,
    ];

    protected $fillable = [
        'name',
        'thumb',
        'hospital',
        'title',
        'info',
        'description',
        'enable',
        'order_n',
        'show_home',
    ];

    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
    }

}
